package com.epigeon.amadeo.impl;

import java.util.Map;

import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.widget.EditText;

import com.epigeon.amadeo.input.PassiveInput;
import com.epigeon.amadeo.model.StringMessage;

public class PassiveEditText extends EditText implements PassiveInput {

	public String key;

	public PassiveEditText(Context context, AttributeSet attrs) {
		super(context, attrs);
	}
	
	@Override
	public StringMessage getMessage() {
		return new StringMessage(null, this.getKey(), this.getText().toString());
	}

	@Override
	public void setParameters(Map<String, String> parameterMap) {
		String value = parameterMap.get("text_value");
		if ( value != null ) {
			this.setText(value);
			Log.d("hehe", value);
		}
	}

	@Override
	public String getKey() {
		return key;
	}

	@Override
	public void setKey(String key) {
		this.key = key;		
	}
	
}
